import api from '@/utils/api';
import registerServer from '@/utils/register-server';
import request from '@/utils/request';

const {
  get_videos,
  document_BangDing_get,
  get_knowledgebase_name,
  documents_resources,
} = api;

const methods = {
  get_videos: {
    url: get_videos,
    method: 'get',
  },
  document_BangDing_get: {
    url: document_BangDing_get,
    method: 'post',
  },
  get_knowledgebase_name: {
    url: get_knowledgebase_name,
    method: 'post',
  },
  documents_resources: {
    url: documents_resources,
    method: 'post',
  },
} as const;

export const getVideoDetail = (videoId: string) =>
  request.get(api.getVideo(videoId));

export const getDocumentOss = (document_id: string) =>
  request.get(api.document_oss_get(document_id));

export const getDocumentVideo = (document_id: string) =>
  request.get(api.document_video_get(document_id));

const videoGet = registerServer<keyof typeof methods>(methods, request);

export default videoGet;
